package com.sduept.bigdata.iec61850.client;

import com.beanit.iec61850bean.ClientEventListener;
import com.beanit.iec61850bean.Report;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 */
public class DefaultClientEventListener implements ClientEventListener {
	private static Logger logger = LoggerFactory.getLogger(ClientEventListener.class);
    private final int serverPort;
    private final String serverAddress;

    public DefaultClientEventListener(int serverPort, String serverAddress) {
        this.serverPort = serverPort;
        this.serverAddress = serverAddress;
    }

    @Override
    public void newReport(Report report) {
        logger.info("接收到报告,报告ID：{}，报告dataset：{}",report.getRptId(),report.getDataSetRef());
        logger.info(report.toString());
    }

    @Override
    public void associationClosed(IOException e) {
        logger.error("server  {} colsed",serverAddress,e);
    }
}
